package com.dbms.controller;

import com.dbms.common.annotation.ResponseResult;
import com.dbms.domain.dto.BisXnjmodeProjectDTO;
import com.dbms.domain.vo.BisXnjmodeProjectVO;
import com.dbms.domain.vo.QueryByIdForResultVO;
import com.dbms.service.BisXnjmodeProjectService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@Tag(name = "project汇总数据", description = "project汇总数据相关接口")
@RestController
@RequestMapping("/bis_xnj_mode_project")
@RequiredArgsConstructor
public class BisXnjmodeProjectController {

    final BisXnjmodeProjectService bisXnjmodeProjectService;

    @Operation(summary = "project列表", description = "project列表")
    @GetMapping("/querByList")
    public ResponseResult<List<BisXnjmodeProjectVO>> querByList(@RequestParam("strcR") String strcR,@RequestParam("type") Integer type){
        return ResponseResult.success(bisXnjmodeProjectService.querByList(strcR,type));
    }

    @Operation(summary = "project保存", description = "project保存")
    @PostMapping("/save")
    public ResponseResult<Boolean> save(@RequestBody BisXnjmodeProjectDTO dto){
        return ResponseResult.success(bisXnjmodeProjectService.save(dto));
    }

    @Operation(summary = "project删除", description = "project删除")
    @DeleteMapping("/deleteByIds")
    public ResponseResult<Boolean> deleteByIds(@RequestBody List<String> ids){
        return ResponseResult.success(bisXnjmodeProjectService.deleteByIds(ids));
    }

    @Operation(summary = "project停止", description = "project停止")
    @GetMapping("/stop")
    public ResponseResult<Boolean> stop(@RequestParam("id") String id){
        return ResponseResult.success(bisXnjmodeProjectService.stop(id));
    }

    @Operation(summary = "project率定", description = "project率定")
    @GetMapping("/lvding")
    public ResponseResult<Boolean> lvding(@RequestParam("id") String id) throws IOException {
        return ResponseResult.success(bisXnjmodeProjectService.lvding(id));
    }

    @Operation(summary = "project计算", description = "project计算")
    @GetMapping("/count")
    public ResponseResult<Boolean> count(@RequestParam("id") String id) throws IOException {
        return ResponseResult.success(bisXnjmodeProjectService.count(id));
    }

    @Operation(summary = "折线图", description = "折线图")
    @GetMapping("/queryByIdForResult")
    public ResponseResult<List<QueryByIdForResultVO>> queryByIdForResult(@RequestParam("id") String id){
        return ResponseResult.success(bisXnjmodeProjectService.queryByIdForResult(id));
    }
}
